{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.0\n",
      "45.0\n",
      "90.0\n",
      "135.0\n",
      "180.0\n",
      "-135.0\n",
      "-45.0\n",
      "0.0\n"
     ]
    }
   ],
   "source": [
    "import math         ### fig:atan2\n",
    "\n",
    "### xy座標を入力するとdegreeで値を表示する手続き###\n",
    "def print_atan2_deg(x,y):\n",
    "    print(math.atan2(y,x)/math.pi*180)\n",
    "\n",
    "print_atan2_deg(1,0)   # X軸 -> 0\n",
    "print_atan2_deg(1,1)   # 第1象限: 0〜90\n",
    "print_atan2_deg(0,1)   # Y軸 -> 90\n",
    "print_atan2_deg(-1,1)  # 第2象限: 90〜180\n",
    "print_atan2_deg(-1,0)   # X軸負の方向-> 180\n",
    "print_atan2_deg(-1,-1)  # 第3象限: -180〜-90\n",
    "print_atan2_deg(1,-1)  # 第4象限: -90〜0\n",
    "print_atan2_deg(0,0)   # 原点は本来値が未定になるが0が返る"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
